<template>
    <div class="app-container">
      <el-upload
        class="upload-demo"
        :show-file-list="false"
        action="http://127.0.0.1:9999/file/upload"
        name="file"
        :headers="header"
        :data="file_info"
        :on-success="file_upload"
      >
        <el-button type="primary">上传</el-button>
      </el-upload>
      <button @click="draw1">绘图1</button>
      ||
      <button @click="draw2">绘图2</button>
    </div>
  </template>
  
  <script>
  import { Message } from 'element-ui'
  
  export default {
    data() {
      return {
        header: {
          "X-Token": "xxxx",
        },
      };
    },
    computed: {
      file_info() {
        const data = {
          user_id: '1'
        };
        return data
      },
    },
    methods: {
      file_upload(resp) {
        Message({
            message: resp.msg,
            type: 'success',
            duration: 5 * 1000
        })
      },
      draw1(){
        this.$axios.get("/file/draw").then((res) => {
        console.log(res)
        })      
      },
      draw2(){
        window.open('http://127.0.0.1:9999/dash/draw','_blank') 
      },
    },
  };
  </script>
  